-
Notifications
You must be signed in to change notification settings - Fork 14.7k
KAFKA-19749 The version-mapping
of kafka-features.sh should work without requiring the bootstrap
#20619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
version-mapping
of kafka-features.sh should work without requiring the bootstrapversion-mapping
of kafka-features.sh should work without requiring the bootstrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
// bootstrap_server and bootstrap_controller are in a mutually exclusive group, | ||
// so the exception happens only when both of them are missing | ||
throw new ArgumentParserException("one of the arguments --bootstrap-server --bootstrap-controller is required", parser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about new ArgumentParserException(e.getMessage(), parser)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! Yes, it's better to use the existing message rather than write a new one. The code has been updated.
Namespace namespace = parser.parseArgsOrFail(args); | ||
Namespace namespace = parser.parseArgs(args); | ||
String command = namespace.getString("command"); | ||
if (command.equals("version-mapping")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach allows version-mapping
to be used with both bootstrap-server
and bootstrap-controller
, which seems a bit odd to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version-mapping
and feature-dependencies
subcommands don't use bootstrap-server
and bootstrap-controller
arguments at all. The best practice is to let these arguments be required arguments of other subcommands. But I am not sure whether this change will require an KIP or worth one. Do you have any suggestion?
Or, we can check whether user uses these arguments with version-mapping
and feature-dependencies
, which makes the code more ugly but can provide user more information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I am not sure whether this change will require an KIP or worth one. Do you have any suggestion?
That is a good point. Let's keep this version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could file a KIP to deprecate the config. It shows a warning message in 4.x, but it will stop the tool with an exception in 5.x. What do you think?
Description
In kafka-features.sh, exclusive argument group of
--bootstrap-server
and
--bootstrap-controller
is required in the main parser, butversion-mapping
andfeature-dependencies
subcommands don't need theinformation.
Changes
To avoid change in argument level, the exclusive group is not moved. It
is now not required and only check for existence if the subcommand needs
it.
Since
FeatureCommand#mainNoExit
catchesArgumentParserException
,ArgumentParser#parseArgs
is used instead ofparseArgsOrFail
. Itmakes testing easier.
Two tests are added. One tests whether not-remote subcommand can execute
without bootstrap. Another tests whether remote subcommand cannot
execute without bootstrap.
Reviewers: Ken Huang [email protected], Jhen-Yung Hsu
[email protected], TaiJuWu [email protected], Chia-Ping Tsai
[email protected]